<?php
/***************************************************************************
 * 
 * Copyright (c) 2010 , Inc. All Rights Reserved
 * $Id$:URLAccessFilter.php,2010/05/31 15:34:49 
 * 
 **************************************************************************/
 
 
 
/**
 * @file URLAccessFilter.php
 * @author huqingping
 * @date 2010/05/31 15:34:49
 * @version 1.0 
 * @brief 
 *  
 **/
require_once 'urlacl/URLAcl.php';

class URLAccessFilter implements IFilter
{
	function execute(WebApp $app)
	{
		if (empty($app->request->userData['_user'])) {
			//强制登陆
			throw new Exception('hapn.u_login'); 
		}
		$url = $app->request->url;
		$user = $app->request->userData['_user'];

		$db = Conf::get('urlacl.dbname','urlacl');
		$supers = Conf::get('urlacl.supers',array());
		$acl = new URLAcl($db,$supers);
		if (!$acl->hasPriv($user['uname'], $url)) {
			throw new Exception('hapn.u_power');
		}
	}
}





/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
